package Admin;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.ImageIcon;

public class ViewPhoto extends JFrame {

	private JPanel contentPane;
	private JLabel lblNewLabel;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ViewPhoto frame = new ViewPhoto();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ViewPhoto() {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 425, 591);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		contentPane.add(getLblNewLabel(), BorderLayout.CENTER);
	}
	
	public ViewPhoto(String path){
		this();
		try{
		BufferedImage bi=new BufferedImage(410, 591,BufferedImage.TYPE_INT_RGB);

		Graphics2D g=bi.createGraphics();

		Image img=ImageIO.read(new File("C://Users//이종기//Desktop//HTA//FinalWorkspace//FinalProjectWeb//WebContent//ReservationPhoto//"+path));

		g.drawImage(img, 0, 0,410, 591, null);

		g.dispose();
		
		lblNewLabel.setIcon(new ImageIcon(bi));
		}catch(Exception e){
			e.printStackTrace();
		}
		
		
		
	}
	
	
	private JLabel getLblNewLabel() {
		if (lblNewLabel == null) {
			lblNewLabel = new JLabel("");
			
		}
		return lblNewLabel;
	}
}
